<script setup>
// 无图片卡片
import { ref, defineProps } from 'vue'

const props = defineProps({
    title: {
        type: String,
        default: '最新动态'
    },
    contents: {
        type: Array,
        default: [{ "articleImg": "/vite.svg", "title": "Vite + Vue", "views": "1000","articleId":""}]
    }
})
</script>

<template>
    <!-- 无图迷你卡片 -->
    <div class="min-card2">
        <div class="m-title">
            <span>{{ title }}</span>
            <div>
                <p></p>
                <p></p>
            </div>
        </div>
        <div class="m-content" v-for="(item, index) in contents" :key="index" @click="$router.push('/articleDetail/'+item.articleId)">
            <div class="m-content-item">
                <p>{{ item.title }}</p>
                <span>{{ item.views }} views</span>
            </div>
        </div>
    </div>
</template>

<style lang="scss" scoped>
@keyframes cardIn {
    0% {
        transform: translate(0, -20%);
    }
    100% {
        transform: translate(0, 0);
    }
}
/* 卡片样式开始 */
.min-card2 {
    padding-bottom: 16px;
    min-width: 220px;
    width: 250px;
    border-radius: 5px;
    box-shadow: 0 0 2px rgba(0, 0, 0, .2);
    display: flex;
    flex-direction: column;
    background-color: #fff;
    transition: all .3s;
    margin-bottom: 16px;
    animation: cardIn .3s ease-in-out;
}

/* 标题开始 */
.min-card2 .m-title {
    padding: 16px;
    margin-bottom: 4px;
    color: #777777;
}

.min-card2 .m-title div {
    display: flex;
    align-items: center;
    justify-content: left;
}

.min-card2 .m-title span {
    font-size: 14px;
}

.min-card2 .m-title>div>p:first-child {
    flex: 1;
    height: 3px;
    background-color: red;
    width: 60px;
    margin-top: 10px;
}

.min-card2 .m-title>div>p:last-child {
    margin-top: 10px;
    flex: 3;
    height: 3px;
    border-bottom: 1px solid #999;
}

/* 标题结束 */
/* 内容开始 */
.m-content {
    display: flex;
    justify-content: left;
    flex-direction: column;

}

.m-content-item {
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: left;
}

.m-content-item p {
    cursor: pointer;    
    padding: 0 16px;
    font-size: 14px;
    color: #666666;
}

.m-content-item span {
    padding: 0 16px;
    font-size: 12px;
    color: #999;
}

.m-content-item:hover {
    background-color: #f2f2f2;
}

/* 内容结束 */
/* 卡片样式结束 */
</style>